PROJECT(db-nmc)

SET(VERSION 0.1)

SET(CMAKE_MODULE_PATH ${db-nmc_SOURCE_DIR}/make/cmake ${CMAKE_MODULE_PATH})

FIND_PACKAGE(SDL REQUIRED)
INCLUDE_DIRECTORIES(${SDL_INCLUDE_DIR})
LINK_LIBRARIES(${SDL_LIBRARY})

FIND_PACKAGE(SDL_image REQUIRED)
INCLUDE_DIRECTORIES(${SDLIMAGE_INCLUDE_DIR})
LINK_LIBRARIES(${SDLIMAGE_LIBRARY})

FIND_PACKAGE(OpenGL REQUIRED)
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
LINK_LIBRARIES(${OPENGL_LIBRARY})

#SET(DB-NMC_DATADIR ".")
#SET(FLAGS "${FLAGS} -DDB-NMC_DATADIR=\\\"${PKG_DATADIR}/\\\"")

INCLUDE_DIRECTORIES(${db-nmc_SOURCE_DIR}/src/ ${db-nmc_SOURCE_DIR}/src/guichan/)

FILE(GLOB db-nmc_SOURCES_ROOT RELATIVE ${db-nmc_SOURCE_DIR} src/*.hpp src/*.cpp)
SOURCE_GROUP(src FILES ${db-nmc_SOURCES_ROOT})
             
FILE(GLOB db-nmc_SOURCES_ACTOR RELATIVE ${db-nmc_SOURCE_DIR} src/actor/*.hpp src/actor/*.cpp)
SOURCE_GROUP(src/actor FILES ${db-nmc_SOURCES_ACTOR})

FILE(GLOB db-nmc_SOURCES_GUICHAN RELATIVE ${db-nmc_SOURCE_DIR} src/guichan/*.hpp src/guichan/*.cpp)
SOURCE_GROUP(src/guichan FILES ${db-nmc_SOURCES_GUICHAN})

FILE(GLOB db-nmc_SOURCES_GUICHAN_OPENGL RELATIVE ${db-nmc_SOURCE_DIR} src/guichan/opengl/*.hpp src/guichan/opengl/*.cpp)
SOURCE_GROUP(src/guichan/opengl FILES ${db-nmc_SOURCES_GUICHAN_OPENGL})
       
FILE(GLOB db-nmc_SOURCES_GUICHAN_SDL RELATIVE ${db-nmc_SOURCE_DIR} src/guichan/sdl/*.hpp src/guichan/sdl/*.cpp)
SOURCE_GROUP(src/guichan/sdl FILES ${db-nmc_SOURCES_GUICHAN_SDL})
      
FILE(GLOB db-nmc_SOURCES_GUICHAN_WIDGETS RELATIVE ${db-nmc_SOURCE_DIR} src/guichan/widgets/*.hpp src/guichan/widgets/*.cpp)
SOURCE_GROUP(src/guichan/widgets FILES ${db-nmc_SOURCES_GUICHAN_WIDGETS})

FILE(GLOB db-nmc_SOURCES_TILE RELATIVE ${db-nmc_SOURCE_DIR} src/tile/*.hpp src/tile/*.cpp)
SOURCE_GROUP(src/tile FILES ${db-nmc_SOURCES_TILE})

FILE(GLOB db-nmc_SOURCES_UTIL RELATIVE ${db-nmc_SOURCE_DIR} src/util/*.hpp src/util/*.cpp)
SOURCE_GROUP(src/util FILES ${db-nmc_SOURCES_UTIL})
             
ADD_EXECUTABLE(db-nmc 
               ${db-nmc_SOURCES_ROOT}
               ${db-nmc_SOURCES_ACTOR}
               ${db-nmc_SOURCES_GUICHAN}
               ${db-nmc_SOURCES_GUICHAN_OPENGL}
               ${db-nmc_SOURCES_GUICHAN_SDL}
               ${db-nmc_SOURCES_GUICHAN_WIDGETS}
               ${db-nmc_SOURCES_TILE}
               ${db-nmc_SOURCES_UTIL})
               
INSTALL(TARGETS db-nmc RUNTIME DESTINATION ${db-nmc_SOURCE_DIR})